<template>
  <div class="login">
	<div class="loginCard">
	<el-card>
	  <el-form label-width="80px" :model="login" class="loginForm">
	    <el-form-item label="用户:">
	      <el-input v-model="login.name"></el-input>
	    </el-form-item>
		<br />
	    <el-form-item label="密码:">
	      <el-input v-model="login.password"></el-input>
	    </el-form-item>
	  </el-form>
	 
	  <el-button type="success" @click="toregister()">提交</el-button>
	  <el-button type="success" @click="tologin()">返回</el-button>
	</el-card>
	</div>
  </div>
</template>

<script>
	export default {
		data() {
			return {
				radio:"1",
				login: {
					"name": "",
					"password":"",
				}
			}
		},
		
		methods: {
			toregister() {
				this.$http.post('register/', this.login).then(res => {
					if(res.data.status == 2000){
						this.$message.success("注册成功");
					}
					else {
						this.$message.error("注册失败");
					}
					
				})
			},
			tologin() {
				this.$router.push("/");
			}
		}
		
	}
</script>

<style>
	.el-card {
		width: 400px;
		height: 400px;
	}
	.login {
		background-color: #575f81;
		height: 100%;
		width:100%;
		position:fixed;
	}
	.loginForm {
		
		margin-top: 100px;
		margin-right: 90px;
	}
	.loginCard {
		margin-top: 100px;
		display: flex;
		justify-content: center;
		text-align: center;
	}
</style>
